package com.pll.controller.order;

import com.pll.controller.admin.order.vo.ConditionPaginationVO;
import com.pll.dto.ResponseDto;
import com.pll.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;

/**
 * @className: OrderController
 * @author: XR_Z
 * @date: 2025/6/9 18:54
 * @Version: 1.0
 * @description: 订单相关Controller
 */

@RestController
@RequestMapping("/order")
public class OrderController {

    @Autowired
    private OrderService orderService;

    /**
     * 多条件复合分页获取订单信息
     * @param conditionPaginationVO 分页条件信息
     * @return dto
     */
    @PostMapping("/pendingOrders")
    public ResponseDto pendingOrders(@RequestBody ConditionPaginationVO conditionPaginationVO) {
        return orderService.pendingOrders(conditionPaginationVO);
    }

    /**
     * 将某个待确定订单修改为已接单
     * @param id 订单id
     * @return  dto
     */
    @PostMapping("/modifiedToReceived")
    public ResponseDto modifiedToReceived(@RequestParam int id){

        return orderService.modifiedToReceived(id);
    }

    /**
     * 批量修改待确定订单为已接单
     * @param ids 需要修改的订单ID集合
     * @return dto
     */
    @PostMapping("/volumeLawsOrdersTaken")
    public ResponseDto volumeLawsOrdersTaken(@RequestBody ArrayList<Integer> ids){

        return orderService.volumeLawsOrdersTaken(ids);
    }

    /**
     * 将某个待确定订单修改为已接单
     * @param id 订单id
     * @return dto
     */
    @PostMapping("/refuse")
    public ResponseDto refuse(@RequestParam int id) {
        return orderService.refuse(id);
    }

    /**
     * 批量修改待确定订单为已接单
     * @param ids 修要修改的订单ID集合
     * @return dto
     */
    @PostMapping("/bulkRejection")
    public ResponseDto bulkRejection(@RequestBody ArrayList<Integer> ids) {
        return orderService.bulkRejection(ids);
    }
}
